package Test;

import static org.junit.Assert.*;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

import Calculate.ByteCalc;
import Script.SpecialCharSet;

public class SpecialCharSetTest {
	private String separator;
	
	@Before
	public void setup() {
		separator = System.getProperty("line.separator");
	}
	
	@Test
	public void addingSpecialCharMakesItTurnUpInDumpTable() {
		SpecialCharSet spSet = new SpecialCharSet();
		
		spSet.addSpecialChar(ByteCalc.longToByteArray(34), '*');
		
		assertEquals(spSet.get(ByteCalc.longToByteArray(34)), "<LINE>" + separator);
	}
	
	@Test
	public void addingSpecialCharMakesItTurnUpInInsertTable() {
		SpecialCharSet spSet = new SpecialCharSet();
		
		spSet.addSpecialChar(ByteCalc.longToByteArray(34), '*');
		
		assertEquals("<LINE>" + separator, spSet.get(ByteCalc.longToByteArray(34)));
	}
	
	@Test
	public void SpecialCharSetCanIdentifySpecialCharacters() {
		SpecialCharSet spSet = new SpecialCharSet();
		
		assertTrue(spSet.isSpecialCharacter("*"));
	}
}
